package com.gy.bearhelps.util;

import java.util.ArrayList;
import java.util.List;

/**
 * 作者：gy on 16/11/4
 * 说明：
 */
public class LocationManagers {

    private static LocationManagers instance;
    private List<LocationChange> list = new ArrayList<>();

    public static LocationManagers getInstance() {
        if (instance == null) {
            instance = new LocationManagers();
        }
        return instance;
    }

    public void addListener(LocationChange listener) {
        if (!list.contains(listener)) {
            list.add(listener);
        }
    }

    public void notifys() {
        for (LocationChange listener : list) {
            listener.locationChange();
        }
    }

    public interface LocationChange {
        void locationChange();
    }

}
